# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time

  # See ActionController::RequestForgeryProtection for details
  # Uncomment the :secret if you're not using the cookie session store
  protect_from_forgery # :secret => '65775dc3a1f781bc1307bfebf9f3d545'
  
  # See ActionController::Base for details 
  # Uncomment this to filter the contents of submitted sensitive data parameters
  # from your application log (in this case, all fields with names like "password"). 
  # filter_parameter_logging :password

  before_filter :get_date_list
  before_filter :get_new_comments
  before_filter :get_blog
  before_filter :get_friend_blogs

  private
  def get_date_list
    @date_list = Post.date_list
  end

  def get_new_comments
    @new_comments = Comment.find :all, :order => 'created_at DESC', :limit => 5
  end

  def get_blog
    @blog = Blog.first
  end

  def get_friend_blogs
    @friend_blogs = Friendblog.find :all, :order => 'name'
  end

end
